package com.sun.jdk.fun;

import java.util.function.Consumer;

public class ConsumerTest {

    static String strSource = "Hello World";
    
    public static void main(String[] args) {

        // 匿名内部类的方式
        getResult(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s.toLowerCase());
            }
        });
     
        getResult((str) -> {
            System.out.println(str+"--->转换为小写"+str.toLowerCase());
        });
    }
    
    public static void getResult(Consumer<String> consumer){
        consumer.accept(strSource);
    }
}
